/*
 * Books.java
 * 
 * Made by Olof Ekelund, Ludvig Gee, Yacoub Sattar 
 * October 19 2012.
 * This class contains get/set methods to return translated
 * lines from book.txt
 * 
 * Version 1.0
 *  
 * Copyright Olof Ekelund, Ludvig Gee, Yacoub Sattar.
 */

import java.util.Date;
import java.text.SimpleDateFormat;

public class Books {
	SimpleDateFormat dateFormat;
	
	String 	ISBN;
	int 	copyNumber;
	String 	title;
	String 	author;
	String	publisher;
	int 	year;
	int 	statistics;
	Date	borrowDate;
	Date 	returnDate;
	int 	libraryCardNumber;
	
	Books(){
		dateFormat = new SimpleDateFormat("yyMMdd");
		
		ISBN = "";
		copyNumber = 0;
		title = "";
		author = "";
		publisher = "";
		year = 0;
		statistics = 0;
		borrowDate = new Date();
		returnDate = new Date(0);
		libraryCardNumber = 0;
	}
	
	public String getBookAsString(){
		if(returnDate.equals(new Date(0))){
			return (ISBN + "#" + copyNumber + "#" + title + "#" + author + "#" + 
					year + "#" + statistics + "#" + dateFormat.format(borrowDate) 
					+ "\n");
		}
		else{
			return (ISBN + "#" + copyNumber + "#" + title + "#" + author + "#" + 
					year + "#" + statistics + "#" + dateFormat.format(borrowDate) 
					+ "#" + dateFormat.format(returnDate) + "#" + libraryCardNumber + "\n");
		}
	}
	
	public void setISBN(String isbn){
		ISBN = isbn;
	}
	
	public String getISBN(){
		return ISBN;
	}
	
	public void setCopyNumber(int cn){
		copyNumber = cn;
	}
	
	public int getCopyNumber(){
		return copyNumber;
	}
	
	public void setTitle(String t){
		title = t;
	}
	
	public String getTitle(){
		return title;
	}
	
	public void setAuthor(String a){
		author = a;
	}
	
	public String getAuthor(){
		return author;
	}
	
	public void setPublisher(String p){
		publisher = p;
	}
	
	public String getPublisher(){
		return publisher;
	}
	
	public void setYear(int y){
		year = y;
	}
	
	public int getYear(){
		return year;
	}
	
	public void setStatistics(int s){
		statistics = s;
	}
	
	public int getStatistics(){
		return statistics;
	}
	
	public void setBorrowDate(Date b){
		borrowDate = b;
	}
	
	public Date getBorrowDate(){
		return borrowDate;
	}
	
	public void setReturnDate(Date r){
		returnDate = r;
	}
	
	public Date getReturnDate(){
		return returnDate;
	}
	
	public void setLibraryCardNumber(int l){
		libraryCardNumber = l;
	}
}
